package ${package};

#foreach ($import in $imports)
import ${import};
#end

//<bucb> User Defined Imports
//<eucb>

@Entity
@Table("TB_${table}")
public class ${name}  {

#foreach ($attr in $attributes)
    private ${attr.type} ${attr.name};
#end

    //<bucb> User Defined Fields
    //<eucb>

#foreach ($attr in $attributes)
#{if}($attr.id)
    @Id
#{end}
    @Column(name="${attr.column}")
    //<bucb>@Annotations-${attr.name.upFirst}
    //<eucb>
    public ${attr.type} get${attr.name.upFirst}() {
        //<bucb> get${attr.name.upFirst}
        //<eucb>
        return this.${attr.name}
    }
    
#end
#foreach ($attr in $attributes)
    public void set${attr.name.upFirst}(${attr.type} value) {
        //<bucb> set${attr.name.upFirst} - ${attr.type}
        //<eucb>
        this.${attr.name} = value;
    }
    
#end

    //<bucb> User Defined Relations
    //<eucb>

#foreach ($relation in $relations)
#if(${relation.manytoone})
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
    @JoinColumn(name="${relation.joinname}")
#end
    public ${relation.type} get${relation.name.upFirst}() {
        //<bucb> get${relation.name.upFirst}
        //<eucb>
        return this.${relation.name}
    }
    
#end
#foreach ($relation in $relations)
    public void set${relation.name.upFirst}(${relation.type} value) {
        //<bucb> set${relation.name.upFirst} - ${relation.type}
        //<eucb>
        this.${relation.name} = value;
    }
    
#end

    //<bucb> User Defined Methods
    //<eucb>
    
#foreach ($method in $methods)
    ${method.mkJavaMethod} {
      //<bucb> Method: ${method.mkJavaMethod}
      //<eucb>
    }
    
#end

    //<bucb> User Defined Static Fields
    //<eucb>

    //<bucb> User Defined Static Methods
    //<eucb>
}